#include <iostream>

using namespace std;

unsigned long arrs[5];
int main() {

    int t;

    cin >> t;
    while(t--) {
        cin >> arrs[0] >> arrs[1];
        cin >> arrs[2] >> arrs[3];

        if ((arrs[1] * arrs[1] == arrs[0] * arrs[2])
            && 
        (arrs[2] * arrs[2] == arrs[1] * arrs[3])
        &&
        (arrs[3] * (arrs[3] / arrs[2]) <= 100000)
        ) {
            arrs[4] = arrs[3] * (arrs[3] / arrs[2]);
        }
        else {
            arrs[4] = arrs[3]*2 - arrs[2];
        }


        for (int i = 0; i < 5; ++i) {
            cout <<arrs[i] << " ";
        }
        cout << endl;
    }

    return 0;
}
